package com.java.mall_imooc.common.enums;

import lombok.Getter;
import org.springframework.http.HttpStatus;

/**
 * 响应信息主体枚举类
 * @author jiangli
 * @since 2020-03-15 0:02
 */
@Getter
public enum ResultEnum {

	/*200成功*/
	SUCCESS(HttpStatus.OK.value(),"success"),
	/*500错误*/
	ERROR(HttpStatus.INTERNAL_SERVER_ERROR.value(), "未知异常，请联系管理员"),

	/*用户相关*/
	USERNAME_EXISTS(21001,"用户名已存在"),
	EMAIL_EXISTS(21002,"邮箱已存在"),
	PHONE_EXISTS(21003,"手机号码已存在"),
	PASSWORD_ERROR(21004,"密码错误"),
	NEED_LOGIN(21005,"用户未登录"),
	USERNAME_OR_PASSWORD_ERROR(21006,"用户名或密码错误"),
	GEN_JWT_ERROR(21007,"生成jwt令牌错误"),
	RE_LOGIN(21008,"令牌过期,请重新登录"),

	BAD_SQL_GRAMMAR(22001, "sql语法错误"),
	JSON_PARSE_ERROR(22002, "json解析异常"),
	PARAM_ERROR(22003, "参数不正确"),
	FILE_UPLOAD_ERROR(22004, "文件上传错误"),
	EXCEL_DATA_IMPORT_ERROR(22005, "Excel数据导入错误"),
	URL_ENCODE_ERROR(22006,"url编码失败"),
	ILLEGAL_CALLBACK_REQUEST_ERROR(22007,"非法的回调请求"),
	FETCH_USER_INFO_ERROR(22008,"获取用户信息错误"),

	PRODUCT_OFF_SALE_OR_DELETED(23000,"商品已下架或删除"),
	PRODUCT_NOT_EXIST(23001,"商品不存在"),
	PRODUCT_STOCK_NOT_ENOUGH(23002,"商品库存不足"),
	CART_PRODUCT_NOT_EXIST(23003,"购物车无此商品"),
	SHIPPING_NOT_EXIST(23004,"收货地址不存在"),
	CART_SELECTED_IS_EMPTY(23005,"请至少选择一件商品"),
	ORDER_NOT_EXIST(23006,"订单不存在"),
	ORDER_STATUS_ERROR(23007,"订单状态异常,不能修改"),
	ORDER_PAID(23008,"订单已经支付"),

	;


	private Integer code;

	private String message;

	ResultEnum(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
}